<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>作业01.ATM取款_2024-01-23</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0">
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }
    </style>
    <script>
        let money = 0;//现在账户中现有的余额
        while (true) {
            let choose = prompt("请输入你要的操作:\n1.存钱\n2.取钱\n3.显示余额\n4.退出")
            if (choose === "1") {
                money += parseInt(prompt("请输入存钱的金额"))
            } else if (choose === "2") {
                let takeMoney = parseInt(prompt("请输入取钱的金额"))
                if (takeMoney > money) {
                    alert("余额不足")
                } else {
                    money -= takeMoney;
                }
            } else if (choose === "3") {
                alert(`您当前的余额是${money}`)
            } else if (choose === "4") {
                break;
            }
        }
    </script>
</head>
<body>

</body>
</html>